package store

import (
	"cloud-disk/global/define"
	"fmt"
	"github.com/aliyun/aliyun-oss-go-sdk/oss"
	"os"
)

var c *oss.Client
var b *oss.Bucket

type OSS struct {
}

func InitOSS() {
	conf := define.Conf.OSS
	client, err := oss.New(conf.Endpoint, conf.AccessKey, conf.AccessKeySecret)
	if err != nil {
		fmt.Println("Error:", err)
		os.Exit(-1)
	}
	c = client
	bucket, err := client.Bucket(conf.Bucket)
	fmt.Println(bucket)
	if err != nil {
		fmt.Println("Error:", err)
		os.Exit(-1)
	}
	b = bucket
}
func (OSS) B() *oss.Bucket {
	return b
}
func (OSS) C() *oss.Client {
	return c
}
